# builddir.)
# The official upstream version defined by AC_INIT in configure.in.
-upstream_ver := 24.2
+upstream_ver := $(shell debian/upstream-version)
+ifeq (,$(upstream_ver))
+ $(error 'Unable to find upstream version number.')
+endif
# This must be the version that's actually used at runtime for things
# like load-path. It may not be the same as the upstream version
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use English;
+
+open(my $config_file, '<', 'configure.ac')
+ or die "cannot open configure.ac: $!";
+
+my $version = '';
+my $found_init = 0;
+while (<$config_file>)
+{
+ if(/^AC_INIT\(emacs,\s*(\S+)\s*\)$/o)
+ {
+ $found_init and die 'found duplicate AC_INIT() in configure.ac';
+ $version = $1;
+ $found_init = 1;
+ }
+}
+
+$found_init or die 'no AC_INIT() found in configure.ac';
+print "$version\n";